<template>
	<div>
		<div class="d-flex pl-1 pr-1 a-center j-center pt-1" style="height: 50px;">
			<div style="width: 30px;" class="d-flex a-center j-center" @click="back"> <img src="../assets/images/left.png" alt="" class="w-100 pr-1"></div>
			<div style="width: 80%; height: 100%;"> <input type="text" class="w-100 search" v-model="title" style="height: 100%;" placeholder="智能积木越野四驱车"> </div>
			<div style=""  class="d-flex a-center j-center" @click="find"> 搜索</div>
		</div>	
	</div>
</template>

<script>
	import {search}  from  '../lib/search.js'
	export  default{
	     data(){
			   return {
				     title:""
			   }
		 },
		 created(){
			   this.title= this.$route.query.search;
			   this.searchList({title:this.title,id:28})
		 },
		 methods:{
			  searchList(options={}){
				  options.id = options.id
				  options.title = options.title || "";
				  options.page = options.page || 1;
				  options.all = options.all || "desc";
				  options.sale_count = options.sale_count || "desc";
				  options.min_price = options.min_price  || "desc";
				  options.price = options.price|| "between";
				  console.log(options)
				  search(options).then(res=>{
					   console.log(res)
				  })
			  },
			  back(){
				   this.$router.go(-1)
			  },
			  find(){
				  this.searchList({title:this.title,id:28})
			  }
		 }
	}
</script>

<style scoped>
	.search{
		 border:1px solid #f5f5f5;
		 background-color: #F5F5F5;
		 border-radius: 5px;
	}
</style>
